<template>
  <div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column type="index" label="索引" width="50px">
      </el-table-column>
      <!-- <el-table-column label="序号" width="50">
      <template slot-scope="{ $index }">
          {{ $index + 1 }} </template>
            </el-table-column> -->
      <el-table-column prop="date" label="日期123" width="180">
      </el-table-column>
      <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
      <el-table-column label="性别">
        <template slot-scope="{ row }">
          {{ row.gender === 1 ? "男" : "女" }}
        </template>
      </el-table-column>
      <el-table-column label="操作" width="180">
        <template slot-scope="{ row ,$index}">
          <pre>{{ row }} ==={{$index}}</pre>
          <el-button type="success" @click="del(row)">删除</el-button>
          <el-button type="success">添加</el-button>
        </template>
      </el-table-column>
    </el-table>
    <hr />
    <el-table :data="tableData2">
      <el-table-column label="公司名" prop="companyName" width="80px">
      </el-table-column>
      <!-- <el-table-column label="公司logo" prop="companyLogo"> </el-table-column> -->
      <el-table-column label="公司logo">
        <!-- slot-scope: 是老语法，
          v-slot ：是新语法。效果一样 -->
        <template slot-scope="scope">
          <!-- {{scope.row.companyLogo}}  -->
          <img :src="scope.row.companyLogo" />
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      layout="sizes,prev, pager, next,jumper,total,slot"
      :total="50"
      :page-sizes="[2, 6, 8, 10, 20]"
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    >
      ====web67
    </el-pagination>
  </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          gender: 1,
        },
        {
          date: "2016-05-04",
          name: "王二虎",
          address: "上海市普陀区金沙江路 1517 弄",
          gender: 0,
        },
        {
          date: "2016-05-01",
          name: "王三虎",
          address: "上海市普陀区金沙江路 1519 弄",
          gender: 1,
        },
        {
          date: "2016-05-01",
          name: "王四虎",
          address: "上海市普陀区金沙江路 1511 弄",
          gender: 0,
        },
      ],
      tableData2: [
        {
          companyName: "小米",
          companyLogo: "http://s02.mifile.cn/assets/static/image/logo-mi2.png",
        },
        {
          companyName: "京东",
          companyLogo: "https://misc.360buyimg.com/lib/img/e/logo-201305-b.png",
        },
        {
          companyName: "百度",
          companyLogo:
            "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
        },
      ],
    };
  },
  methods: {
    del(ind) {
      this.tableData.splice(ind, 1);
      console.log(ind);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
  },
};
</script>
<style lang="less" scoped>
img {
  width: 100px;
  height: 100px;
}
</style>>
    
